package com.saltedfish.tool.constant;

import android.os.Environment;

import com.saltedfish.tool.R;
import com.tencent.mm.opensdk.openapi.IWXAPI;

import java.io.File;

import static cn.droidlover.xdroidmvp.util.DateUtils.getString;

public class StringConstant {

    /**
     * SDCARD根目录
     */
    public final static String SDCARD = Environment.getExternalStorageDirectory().getPath();

    /**
     * 项目文件夹
     */
    public final static String STORAGE_DIR = SDCARD + File.separatorChar + "flag" + File.separatorChar;

    public final static String STORAGE_DIRS = SDCARD + File.separatorChar + getString(R.string.app_name) + File.separatorChar;



    /**
     * 奔溃缓存文件夹
     */
    public final static String CACHE = "cache" + File.separatorChar;

    /**
     * log缓存文件夹
     */
    public final static String LOGE = "log" + File.separatorChar;

    /**
     * 项目简报缓存文件夹
     */
    public final static String FILE = "file" + File.separatorChar;

    /**
     * 政策下载文件夹
     */
    public final static String POLICYFILE = "policyFile" + File.separatorChar;

    /**
     * webView缓存文件夹
     */
    public final static String APP_CACAHE_DIRNAME = "/appcache";

    /**
     * 图片缓存文件夹
     */
    public final static String IMAGE = "images" + File.separatorChar;

    public static final String APP_ID = "wx9195110713fd5bd0";
    public static final String APP_SECRET = "ea2ba958343eb7e081baac751efec1f8";
    public static IWXAPI wx_api;

    public static final String DB_PATH = "/data/data/com.saltedfish.tool/databases/";
    public static final String DbBase = "flag.db";


    public static final String TYPE = "TYPE";
    public static final String ID = "ID";
    public static final String ID1 = "ID1";
    public static final String WEB_URL = "WEB_URL";
    public static final String NEW_ITEM = "NEW_ITEM";


    public static final String PRIVACY_POLICY = "h5/privacy.html";  //隐私政策
    public static final String DATA_DETAIL = "h5/dataDeclaration.html";   //数据说明
    public static final String USER_SERVICE = "h5/userAgreement.html";  //用户服务协议
    public static final String SHARE_LANDINFO = "h5/landInfo/";  //招拍挂详情分享
    public static final String IM_CONVERSATIONID = "im_ConversationId";  //IM会话ID
    public static final String SEARCH_KEYWORD = "search_keyword";  //搜索关键字
    // 返回选择图片列表的EXTRA_KEY
    public static final String EXTRA_RESULT = "EXTRA_RESULT";
    public static final String DATA_ATTENDANCERULES = "data_attendancerules";//考勤规则，保存jsonString


    /**
     * 图片加后缀
     */
    public final static String IMAGE_DOWNLOAD = "?download=0";


    public static String getLogDir() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + LOGE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + LOGE;
    }

    public static String getCacheDir() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + CACHE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + CACHE;
    }

    public static String getImageDir() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + IMAGE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + IMAGE;
    }

    public static String getImageDirs() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + IMAGE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + IMAGE;
    }

    public static String getFileDir() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + FILE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + FILE;
    }

    public static String getPolicyFileDir() {
        File file = Environment.getExternalStorageDirectory();
        if (file.canWrite()) {
            file = new File(STORAGE_DIR + POLICYFILE);
            if (!file.exists()) {
                file.mkdirs();
            }
        }
        return STORAGE_DIR + POLICYFILE;
    }


    /**
     * 发送短信类型（1：注册 2：忘记密码）
     */
    public static final class sendSM {

        public static final String FROGET = "2";

        public static final String REGISTER = "1";

    }


    /**
     * 补卡界面
     */
    public static final class clockCard {

        //我发起的
        public static final String LAUNCHEBYME = "1";
        //抄送我的
        public static final String COPYME = "2";
        //审批完成
        public static final String APPROVEDONE = "3";
        //等待审批列表
        public static final String APPROVEWAIT = "4";
        //别人的补卡记录
        public static final String OTHERCLOCK = "5";

    }

}
